home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / gfx / pbm / extra.lzh / extra / src / mitsu.h next >
C/C++ Source or Header  |  1992-03-19  |  4KB  |  129 lines

  1. /* static char SCCSid[] = "@(#)mitsu.h\t\t1.3\t(SPZ)\t3/11/92\n"; */
  2. #include <stdio.h>
  3. #define FALSE 0
  4. #define TRUE  1
  5. #define mytoupper(x) (islower(x) ? toupper(x) : (x))
  6.  
  7. #define HASHSIZE 2048
  8. #define myhash(x) ((PPM_GETR(x)*3 + PPM_GETG(x)*5 + PPM_GETB(x)*7) % HASHSIZE)
  9.  
  10. typedef struct hashinfo {
  11.         pixel     color;
  12.         long      flag;
  13.         struct hashinfo *next;
  14. } hashinfo;
  15.  
  16. struct mediasize {
  17.         char size;
  18.         int  maxcols, maxrows;
  19. };
  20.  
  21. #ifdef __STDC__
  22. static void lineputinit(int cols, int rows, int sharpness, int enlarge, int
  23. copy, struct mediasize medias);
  24. static void frametransferinit(int cols, int rows, int sharpness, int enlarge,
  25. int copy, struct mediasize medias);
  26. static void lookuptableinit(int sharpness, int enlarge, int copy, struct mediasize medias);
  27. static void lookuptabledata(int cols, int rows, int enlarge, struct mediasize
  28. medias);
  29. #define CONST const
  30. #else /*__STDC__*/
  31. static int lineputinit();
  32. static int lookuptableinit();
  33. static int lookuptabledata();
  34. static int frametransferinit();
  35. #define CONST
  36. #endif
  37.  
  38. #define cmd(arg)           fputc((arg), stdout)
  39. #define datum(arg)         fputc((char)(arg), stdout)
  40. #define data(arg,num)      fwrite((arg), sizeof(char), (num), stdout)
  41.  
  42. #define MAXLUTCOL   255
  43.  
  44. #define A4_MAXCOLS  1184
  45. #define A4_MAXROWS  1452
  46. #define A4S_MAXROWS 1754
  47. #define A_MAXCOLS   1216
  48. #define A_MAXROWS   1350
  49. #define AS_MAXROWS  1650
  50.  
  51. #define ONLINE         cmd('\021')
  52. #define CLRMEM         cmd('\033'), cmd('Z')
  53.  
  54. CONST struct mediasize MSize_User={' ',1184,1350};
  55. CONST struct mediasize MSize_A4  ={'0',1184,1452};
  56. CONST struct mediasize MSize_A   ={'1',1216,1350};
  57. CONST struct mediasize MSize_A4S ={'2',1184,1754};
  58. CONST struct mediasize MSize_AS  ={'3',1216,1650};
  59. #define MEDIASIZE(chr) cmd('\033'), cmd('#'), cmd('P'), cmd((chr).size)
  60.  
  61. #define HENLARGE(enl)  cmd('\033'), cmd('&'), cmd('P'), cmd(enl), cmd('\001')
  62. #define VENLARGE(enl)  cmd('\033'), cmd('&'), cmd('Q'), cmd(enl), cmd('\001')
  63. #define NOENLARGE '\001'
  64. #define ENLARGEx2 '\002'
  65. #define ENLARGEx3 '\003'
  66.  
  67. #define COLREVERSION(arg) cmd('\033'), cmd('&'), cmd('W'), cmd(arg)
  68. #define DONTREVERTCOLOR '0'
  69. #define REVERTCOLOR   '2'
  70.  
  71. #define NUMCOPY(num)   cmd('\033'), cmd('#'), cmd('C'), cmd((num) & 0xff)
  72.  
  73. #define HOFFINCH(off)  cmd('\033'), cmd('&'), cmd('S'), cmd((off) & 0xff)
  74. #define VOFFINCH(off)  cmd('\033'), cmd('&'), cmd('T'), cmd((off) & 0xff)
  75.  
  76. #define CENTERING(cen) cmd('\033'), cmd('&'), cmd('C'), cmd(cen)
  77. #define DONTCENTER '0'
  78. #define DOCENTER   '1'
  79.  
  80. #define TRANSFERFORMAT(fmt) cmd('\033'), cmd('&'), cmd('A'), cmd(fmt)
  81. #define FRAMEORDER  '0'
  82. #define LINEORDER   '1'
  83. #define LOOKUPTABLE '3'
  84.  
  85. #define COLORSYSTEM(cs) cmd('\033'), cmd('&'), cmd('I'), cmd(cs)
  86. #define RGB '0'
  87. #define YMC '1'
  88.  
  89. #define SHARPNESS(spn) cmd('\033'), cmd('#'), cmd('E'), cmd(spn)
  90. #define SP_USER ' '
  91. #define SP_NONE '0'
  92. #define SP_LOW  '1'
  93. #define SP_MIDLOW '2'
  94. #define SP_MIDHIGH '3'
  95. #define SP_HIGH '4'
  96.  
  97. #define COLORDES(col) cmd('\033'), cmd('C'), cmd(col)
  98. #define RED   '1'
  99. #define GREEN '2'
  100. #define BLUE  '3'
  101. #define YELLOW  '1'
  102. #define MAGENTA '2'
  103. #define CYAN    '3'
  104.  
  105. #define HPIXELS(hpix) cmd('\033'), cmd('&'), cmd('H'),\
  106.                                                         cmd(((hpix) >> 8) & 0xff), cmd((hpix) & 0xff)
  107. #define VPIXELS(vpix) cmd('\033'), cmd('&'), cmd('V'),\
  108.                                                         cmd(((vpix) >> 8) & 0xff), cmd((vpix) & 0xff)
  109. #define HPIXELSOFF(hoff) cmd('\033'), cmd('&'), cmd('J'),\
  110.                                                         cmd(((hoff) >> 8) & 0xff), cmd((hoff) & 0xff)
  111. #define VPIXELSOFF(voff) cmd('\033'), cmd('&'), cmd('K'),\
  112.                                                         cmd(((voff) >> 8) & 0xff), cmd((voff) & 0xff)
  113.  
  114. #define GRAYSCALELVL(lvl) cmd('\033'), cmd('#'), cmd('L'), cmd(lvl)
  115. #define BIT_6 '\006'
  116. #define BIT_8 '\010'
  117.  
  118. #define LOADLOOKUPTABLE cmd('\033'), cmd('&'), cmd('L')
  119. #define DONELOOKUPTABLE cmd('\004')
  120.  
  121. #define ROTATEIMG(rot)  cmd('\033'), cmd('#'), cmd('R'), cmd(rot)
  122. #define DONTROTATE '0'
  123. #define DOROTATE   '1'
  124.  
  125. #define DATASTART cmd('\033'), cmd('O')
  126. #define PRINTIT cmd('\014')
  127. #define OFFLINE cmd('\023')
  128.  
  129.